//
//  HPDefine.h
//  Network
//
//  Created by phq on 2019/7/4.
//  Copyright © 2019 phq. All rights reserved.
//

#ifndef HPDefine_h
#define HPDefine_h
#define force_inline __inline__ __attribute__((always_inline))

typedef enum : NSInteger {
    ATokenTypeIphone = 0,   //iphone / 123
    ATokenTypeJjr = 1,          //jjr / jjr889900
    ATokenTypeRecommend = 2,    //recommend / recommend123
    ATokenTypeMessage = 3,      //message / message889900
    ATokenTypeYl1001 = 4,       //yl1001  / yl1001889900
    ATokenTypeYlzhadui = 5,     //ylzhadui / ylzhadui889900
    ATokenTypeYw = 6,           //yw / 123
    
    ATokenTypeTraining = 7,     //新接口框架2020. yewen_college / yewen_college889900
    
    ATokenTypeJava,     //Java新接口框架2021. yljava / yljava889900
    ATokenTypeJavaNew,     //Java新接口框架2023. yljava / yljava889900
    ATokenTypeJavaYp,     //Java 云聘域名新接口框架2022. yljava / yljava889900
    ATokenTypeJavaLive,     //Java新接口框架2022. yljava / yljava889900
    ATokenTypeJavaWebServe,     //Java新接口框架2023微服务. yljava / yljava889900
    
    ATokenTypeJavas,     //Java新接口框架2023微服务. yljava / yljava889900
    
} ATokenType;

/*
 * php api服务体系
 */
static NSString * const kUser_iphone = @"iphone";
static NSString * const kPwd_iphone = @"123";

static NSString * const kUser_yw = @"yw";
static NSString * const kPwd_yw = @"123";
/*
 * php api4服务体系
 */
static NSString * const kUser_jjr = @"jjr";
static NSString * const kPwd_jjr = @"jjr889900";

static NSString * const kUser_recommend = @"recommend";
static NSString * const kPwd_recommend = @"recommend123";

static NSString * const kUser_message = @"message";
static NSString * const kPwd_message = @"message889900";

static NSString * const kUser_yl1001 = @"yl1001";
static NSString * const kPwd_yl1001 = @"yl1001889900";

static NSString * const kUser_ylzhadui = @"ylzhadui";
static NSString * const kPwd_ylzhadui = @"ylzhadui889900";


/* 业问服务体系
 */
static NSString * const kUser_training = @"yewen_college";
static NSString * const kPwd_training = @"yewen_college889900";

/*
 * Java服务体系
 */
static NSString * const kUser_Java = @"yljava";
static NSString * const kPwd_Java = @"yljava889900";

// 解决NSLog打印输出不全
#ifdef DEBUG
#define HPLog(format, ...) printf("class: <%p %s:(%d) > method: %s \n%s\n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String] )
#else
#define HPLog(format, ...)
#endif

static force_inline NSString* HPUserType(ATokenType type) {
    if (type<ATokenTypeIphone || type>ATokenTypeJavas) return nil;
    static NSDictionary *actionEmun = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken,^{
        actionEmun = @{
            @(ATokenTypeIphone):kUser_iphone,
            @(ATokenTypeJjr):kUser_jjr,
            @(ATokenTypeRecommend):kUser_recommend,
            @(ATokenTypeMessage):kUser_message,
            @(ATokenTypeYl1001):kUser_yl1001,
            @(ATokenTypeYlzhadui):kUser_ylzhadui,
            @(ATokenTypeTraining):kUser_training,
            @(ATokenTypeYw):kUser_yw,
            
            @(ATokenTypeJava):kUser_Java,
            @(ATokenTypeJavaNew):kUser_Java,
            @(ATokenTypeJavaYp):kUser_Java,
            @(ATokenTypeJavaLive):kUser_Java,
            @(ATokenTypeJavaWebServe):kUser_Java,
            
            @(ATokenTypeJavas):kUser_Java,
            
        };
    });
    return actionEmun[@(type)];
}

static force_inline NSString* HPPwdType(ATokenType type) {
    if (type<ATokenTypeIphone || type>ATokenTypeJavas) return nil;
    static NSDictionary *actionEmun;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken,^{
        actionEmun = @{
            @(ATokenTypeIphone):kPwd_iphone,
            @(ATokenTypeJjr):kPwd_jjr,
            @(ATokenTypeRecommend):kPwd_recommend,
            @(ATokenTypeMessage):kPwd_message,
            @(ATokenTypeYl1001):kPwd_yl1001,
            @(ATokenTypeYlzhadui):kPwd_ylzhadui,
            @(ATokenTypeTraining):kPwd_training,
            @(ATokenTypeYw):kPwd_yw,
            
            @(ATokenTypeJava):kPwd_Java,
            @(ATokenTypeJavaNew):kPwd_Java,
            @(ATokenTypeJavaYp):kPwd_Java,
            @(ATokenTypeJavaLive):kPwd_Java,
            @(ATokenTypeJavaWebServe):kPwd_Java,
            
            @(ATokenTypeJavas):kPwd_Java,
        };
    });
    return actionEmun[@(type)];
}

#endif /* HPDefine_h */
